<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/layout :: common_header(~{::title},~{::link})">
<title>日志管理</title>
<!-- 
  additional css  -->

</head>

<body>
	<div class="main-container">
		<div class="main-content-inner">
			<div class="page-content">
				<div class="row">

					<div class="row">
						<div class="col-xs-12">
							<form action="" class="form-inline" id="userForm">
								<label>类型：</label><select name="type">
									<option value="">全部</option>
									<option value="1">登入登出</option>
									<option value="2">业务请求</option>
									<option value="3">系统异常</option>
								</select> <label>操作用户：</label><input type="text" name="createBy">
								<button class="btn btn-primary btn-rounded btn-outline btn-sm "
									type="button" onclick="search()">
									<i class="fa fa-search"></i> 查询
								</button>
								<button class="btn btn-primary btn-rounded btn-outline btn-sm "
									type="reset">
									<i class="fa fa-refresh"></i> 重置
								</button>
							</form>
						</div>
					</div>
					<div class="row">
						<div class="col-xs-12">
							<table id="usertable" data-toggle="table"
								data-side-pagination="server" data-striped="true"
								data-query-params="queryParams" data-pagination-loop="false"
								data-page-number="1" data-data-field="list"
								data-total-field="totalRow"
								data-content-type="application/x-www-form-urlencoded"
								data-click-to-select="true" data-pagination="true"
								data-method="post" th:data-url="@{/sys/log/query}">
								<thead>
									<tr>
										<th data-field="id">ID</th>
										<th class="center" data-field="createBy">操作用户</th>
										<th data-field="title">操作名称</th>
										<th data-field="remoteAddr">请求IP</th>
										<th class="hidden-480" data-field="requestUri">请求URL</th>
										<th data-field="method">请求方式</th>
										<th data-field="createDate"><i
											class="ace-icon fa fa-clock-o bigger-110 hidden-480"></i>
											请求时间</th>
										<th data-field="loseTime">用时(ms)</th>
										<th class="hidden-480" data-field="type"
											data-formatter="statusFormatter">日志类型</th>

										<!-- <th data-field="id" data-formatter="optFormatter">操作</th> -->
									</tr>
								</thead>
							</table>
						</div>
					</div>
				</div>
			</div>
			<!-- /.col -->


		</div>
		<!-- end main container -->
	</div>

	<div th:replace="common/commonJS"></div>


	<script>

	 function queryParams(params){
		 var temp = $("#userForm").serializeJSON();
		 temp.pageSize=params.limit;   //页面大小
		 temp.pageNumber=(params.offset / params.limit) + 1;   //页码  
		 temp.sort=params.sort;      //排序列名  
		 temp.sortOrder=	 params.order; //排位命令（desc，asc）
		 return temp; 
	 }
    function statusFormatter(value,row,index){
    	if(value=="1"){
    		return "<span class='label label-sm label-primary'>登入登出</span>"
    	}else if(value=="2"){
    		return "<span class='label label-sm label-success'>业务请求</span>";
    	}else if(value=="3"){
    		return "<span class='label label-sm label-warning'>系统异常</span>";
    	}else{
    		return "<span class='label label-sm label-warning'>其他</span>";
    	}
    }
  
    function search(){
    	$('#usertable').bootstrapTable('refresh');
    }
 
	 $(function () {
	     });
</script>
</body>
</html>